package eteam.aps.gateway.config;

import eteam.aps.gateway.common.GatewayPropertyFactory;
import eteam.aps.gateway.model.TestParamDto;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.annotation.Order;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 此方法读取配置文件，常规字符串配置
 */
@Configuration
@PropertySource(value = {"classpath:modules.yml"}, encoding = "utf-8", factory = GatewayPropertyFactory.class)
public class TestParamConfig {
    @Value("${test-param.param1}")
    private String param1;
    @Value("${test-param.param2}")
    private List<Integer> param2 = new ArrayList<>();
    //@Value("${test-param.param3}")
    private List<TestParamDto> param3 = new ArrayList<>();
    //@Value("${test-param.param4}")
    private List<Map<String, Integer>> param4 = new ArrayList<>();

    //@Bean
    @Order(value = 1)
    public String getParam1() {
        return param1;
    }

    //@Bean
    @Order(value = 2)
    public List<Integer> getParam2() {
        return param2;
    }

    //@Bean
    @Order(value = 3)
    public List<TestParamDto> getParam3() {
        return param3;
    }

    //@Bean
    @Order(value = 4)
    public List<Map<String, Integer>> getParam4() {
        return param4;
    }
}